[client]
port = {{ mysql.port }}
socket=/data/br/mysql/run/mysqld.socket
[mysql]
port = {{ mysql.port }}
#prompt=\\u@\\d \\r:\\m:\\s>
default-character-set=utf8
#collation_server =utf8_bin


[mysqld]
{% if mysql.repl and inventory_hostname == groups.mysql[0] %}
binlog-format=ROW
server-id=1
{% endif %}
{% if mysql.repl and inventory_hostname != groups.mysql[0] %}
{% for host in groups.mysql %}
{% if inventory_hostname == host %}
binlog-format=ROW
server-id={{ loop.index }}
{% endif %}
{% endfor %}
{% endif %}
default-storage-engine=INNODB
#skip-grant-tables
#skip_networking
#collation_server =utf8_bin
explicit_defaults_for_timestamp=true
event_scheduler = 1
default-authentication-plugin=mysql_native_password
default-time-zone = '+8:00'

#dir
innodb_log_group_home_dir=/data/br/mysql/iblog
innodb_data_home_dir=/data/br/mysql/data
datadir=/data/br/mysql/data
tmpdir=/data/br/mysql
slave_load_tmpdir=/data/br/mysql/tmp
log-error=/data/br/mysql/log/alert.log
slow_query_log_file=/data/br/mysql/log/slow.log
relay_log_info_file=/data/br/mysql/binlog/relay-log.info
master-info-file=/data/br/mysql/binlog/master.info
socket=/data/br/mysql/run/mysqld.socket
log-bin=/data/br/mysql/binlog/binlog
relay-log=/data/br/mysql/binlog/relaylog

#metadata_locks_cache_size = 100
back_log = 1024
relay_log_info_repository   = table
master_info_repository      = table




#innodb
innodb_log_files_in_group=4
innodb_log_file_size=512M
innodb_buffer_pool_size=1G
innodb_buffer_pool_instances = 1
innodb_fast_shutdown = 0

innodb_open_files=900000
innodb_flush_log_at_trx_commit=0
innodb_max_dirty_pages_pct=75
innodb_io_capacity=200
innodb_read_io_threads=16
innodb_write_io_threads=16
#innodb_file_format=Barracuda
innodb_file_per_table=1
innodb_thread_concurrency=32
innodb_flush_method=O_DIRECT
innodb_log_buffer_size=32M
innodb_sort_buffer_size = 1M
innodb_buffer_pool_dump_at_shutdown = off
innodb_buffer_pool_load_at_startup  = off
innodb_undo_tablespaces   = 1
#innodb_additional_mem_pool_size=32M

gtid_mode                 = off
enforce_gtid_consistency  = on
transaction-isolation = READ-COMMITTED
tmp_table_size = 24M
#query_cache_type=0
thread_stack=192K
table_definition_cache=2048
thread_cache_size=512
#thread_concurrency = 16
#query_cache_size = 64M
#query_cache_limit = 2M
sql_mode = NO_UNSIGNED_SUBTRACTION,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY


#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_slave_enabled = 1
#rpl_semi_sync_master_timeout = 1000


sync_binlog=0
auto_increment_increment=1
auto_increment_offset=1

max_binlog_size =1024M
binlog_cache_size=512K
max_heap_table_size = 32M
binlog-format=ROW
binlog_row_image = minimal
expire_logs_days=15

log-slave-updates
long_query_time=1#slave-net-timeout = 60
slave-net-timeout = 60

slow_query_log=1
skip-slave-start

#timeout
connect_timeout=30
delayed_insert_timeout =300
innodb_lock_wait_timeout=50
innodb_rollback_on_timeout=OFF
net_read_timeout=30
net_write_timeout=60
slave_net_timeout=30
#table_lock_wait_timeout=50
slave_parallel_workers = 1
slave_pending_jobs_size_max = 128M
skip-name-resolve
max_connect_errors=2000
connect_timeout=30
max_allowed_packet=64M
max_connections=3100
max_user_connections=3000
table_open_cache = 10240
table_open_cache_instances = 16
port = {{ mysql.port }}


#myisam
concurrent_insert=2
key_buffer_size = 2M
sort_buffer_size=1M
join_buffer_size=1M
read_buffer_size=1M
#write_buffer = 8M
myisam_sort_buffer_size=24M
bulk_insert_buffer_size = 64M
myisam_max_sort_file_size = 10G

#common
character-set-server=utf8
lower_case_table_names=1
skip-external-locking
open_files_limit=1000000
read_rnd_buffer_size=1M
safe-user-create
local-infile=0

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
pid-file=/data/br/mysql/run/mysql.pid